<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>toFormateNum</title>
</head>

<body>
    <div id="test" class="test"></div>
    <script>
        const toFormateNum = (num, format, options) =>
            num.toLocaleString(format, options);
        const test = document.querySelector('#test');
        test.textContent = `10000000转换成了:${toFormateNum(10000000, 'cmn-Hans-CN', {
            style: 'currency',
            currency: 'CNY'
        })}`
    </script>
</body>

</html>